<?php 
require('include/book.php');
$keyword = $_GET['keyword'];
@ $from = $_GET['from'];
@ $to = $_GET['to'];
if(!isset($keyword))
  {
    die("");
  }
if(@ !isset($from,$to))
  {
    $books = Book::search_books($keyword);
  }
else
  {
    if(@ $from <=0 || $to <=$from)
      {
	die("");
      }
    $books = Book::search_books($keyword,$from,$to);
  }
if (!$books)
  {
    die('');
  }
echo json_encode($books);
?>